﻿// <copyright file="CriticControl.xaml.cs" company="Microsoft Corporation">
// Copyright (c) 2009 Microsoft Corporation All Rights Reserved
// </copyright>
// <author>Michael S. Scherotter</author>
// <email>mischero@microsoft.com</email>
// <date>2009-4-10</date>
// <summary>Code behind for CriticControl.xaml</summary>

namespace DemoNYTimes
{
    using System.Windows;
    using System.Windows.Controls;
    using System.Windows.Media.Imaging;

    /// <summary>
    /// Critic Silverlight control
    /// </summary>
    public partial class CriticControl : UserControl
    {
        /// <summary>
        /// Initializes a new instance of the CriticControl class.
        /// </summary>
        public CriticControl()
        {
            InitializeComponent();
        }

        /// <summary>
        /// Image failed event handler
        /// </summary>
        /// <param name="sender">the image that failed</param>
        /// <param name="e">the exception routed event arguments</param>
        private void OnImageFailed(object sender, ExceptionRoutedEventArgs e)
        {
            var image = sender as Image;

            var source = image.Source as BitmapImage;

            System.Diagnostics.Debug.WriteLine("Image error with {0}: {1}", source.UriSource, e.ErrorException.Message);
        }
    }
}
